<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>无标题文档</title>



<script src="/js/vue.min.js"></script>

<script src="/elementui/index.js"></script>
<link href="/elementui/index.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="/js/axios.min.js"></script>
<link href="/css/layui.css" rel="stylesheet" type="text/css">  
<link href="/css/base.css" rel="stylesheet" type="text/css">  
</head>

<body style="margin: 13px;">
  <div id="loginDiv">
	<table class="layui-table">
    <thead>
      <tr>
		<th>序号</th>
		<!-- <th>用户</th> -->
		<th>动物</th>
		<th>姓名</th>

		<th>地址</th>
		<th>联系电话</th>
		<th>自我介绍</th>
		<th>申请时间</th>

		<th>回复</th>
		<th>操作</th>
      </tr> 
    </thead>
    <tbody>
      <tr v-for="(shenqing, index) in xianshilist" :key="shenqing.id">
		<td>{{index+1}}</td>
		<!-- <td>{{shenqing.user_id}}</td> -->
		<td>{{shenqing.dongwu.mingcheng}}</td>
		<td>{{shenqing.xingming}}</td>

		<td>{{shenqing.dizhi}}</td>
		<td>{{shenqing.dianhua}}</td>
		<td>{{shenqing.ziwo}}</td>
		<td>{{shenqing.shenqingshi}}</td>

		<td>{{shenqing.huifu}}</td>
		<td>
			<input type="button" value="删除" class="hongse" @click="del(shenqing.id)" style="width: 66px;"/>
	    </td>
      </tr>
    </tbody>
    </table>

	<el-pagination background 
		 layout="total, prev, pager, next" 
		 :total="total" 
		 :page-size="pageSize"
		 :current-page="currentPage" 
		 @current-change="handleCurrentChange">
	</el-pagination>
	

    
  </div>
  


<script type="text/javascript">
	var vm = new Vue({
		
		el: '#loginDiv',
		data: 
		{
			total:0,
			pageSize:222,
			currentPage:1,//当前页

			shenqingList:[],
			xianshilist: null,	

			/* 查询用的 */
			
		},
		methods: 
		{
			getData()
			{
               axios({
						method: 'POST',
						url: '/shenqingMine',
						params:{
							
						}
						}).then(data => {
							if (data.data.state == 66)
							{
								this.shenqingList=data.data.data;
								this.total=this.shenqingList.length;
								
	                            this.xianshilist = this.shenqingList.slice((this.currentPage - 1) * this.pageSize, this.currentPage * this.pageSize)
							} 
						    
						}).catch(error => {
							alert(error);
			    })
			},
			
			handleCurrentChange(currentPage)//用户点的页码
			{
				var _this = this;
				if (_this.shenqingList) 
				{
				   if (currentPage)
				   {
                      _this.currentPage = currentPage;
                   }
                   _this.xianshilist = _this.shenqingList.slice((_this.currentPage - 1) * _this.pageSize,_this.currentPage * _this.pageSize);
                } else {}

			},

			
			
			del(id)
			{
				if(confirm('您确定删除吗？'))
				{
					axios({
						method: 'POST',
						url: '/shenqingDel',
						//data: this.shenqing,
						params:{
							id:id,
						} 
						}).then(data => {
							if (data.data.state == 66)
							{
								alert("删除成功");
								this.currentPage=1;
								this.getData();
							}  
							
						}).catch(error => {
							alert(error);
					})
				}
			},

			

		},
		created()
		{
			this.getData();
		}

	
	    
	})
</script>


<style>
    .el-pagination{
		text-align: right;
		padding-top: 20px;
	}
</style>

</body>
</html>
